package net.cyndeline.events.itemUsage

import net.cyndeline.entitySystem.Event
import net.cyndeline.ItemType
import net.cyndeline.Normal

/**
 * Signals that an entity would like to activate an item located
 * in a spell slot. The entity this event is sent to is the one possessing
 * the slot with the item an it.
 */
trait ActivateSpellSlotEvent extends Event {
  
  /** (x, y) coordinates to use the item on. */
  def target: (Int, Int)
  
  /** Sets a new target. */
  def target_=(target: (Int, Int))
  
  /** The type of slot that should be activated. */
  def slotType: ItemType
  
  /** Sets a new slot type. */
  def slotType_=(slotType: ItemType)
  
  /** Which slot position (based on slot type) the item is in. */
  def slotPosition: Int
  
  /** Sets a new slot position. */
  def slotPosition_=(pos: Int)
  
}

class ActivateSpellSlot extends ActivateSpellSlotEvent {
  var target = (0, 0)
  var slotType: ItemType = Normal
  var slotPosition = 0
  
  override def copy = {
    val copy = new ActivateSpellSlot()
    copy.target = target
    copy.slotType = slotType
    copy.slotPosition = slotPosition
    copy
  }
}